package food;

import java.util.*;

public class WhatDoWeEat{
    public static void main(String[] args) {
        List<Food> foods = new ArrayList<>();
//        Stack stack = new Stack();
//        Map map = new HashMap();
//        map.put(123,132);
//        map.put(124,132);
//        System.out.println("------"+map.entrySet());
//        System.out.println("------"+map.toString());
//        Set set = new HashSet();
//        set.add(1);
	// git test
        foods.add(new Food(1,"炒饭"));
        foods.add(new Food(2,"重庆小面"));
        foods.add(new Food(3,"麻辣香锅"));
        foods.add(new Food(4,"饺子"));
//        foods.add(new Food(5,"炒饭炒面"));
//        foods.add(new Food(6,"蛋炒饭"));
//        foods.add(new Food(7,"自选餐"));
//        foods.add(new Food(8,"老碗面"));
//        foods.add(new Food(9,"biangbiang面"));
//        foods.add(new Food(10,"鱼粉"));
//        foods.add(new Food(11,"混沌"));
//        foods.add(new Food(12,"米饭"));
//        foods.add(new Food(13,"鸭肉饭"));
        System.out.println("最初----------");
        for (Food food : foods) {
            System.out.println(food.getFoodName());
        }
        for (int i = 0; i < foods.size(); i++) {
            if (i==3) {
                foods.set(i,new Food(13,"鸭肉饭"));
            }
        }
        System.out.println("修改了最后一个----------");
        for (Food food : foods) {
            System.out.println(food.getFoodName());
        }
        System.out.println("修改了全部---------");
        Iterator<Food> iterator = foods.iterator();
        while (iterator.hasNext()) {
            iterator.next().setFoodName("修改了全部");
        }
        for (Food food : foods) {
            System.out.println(food.getFoodName());
        }
        //System.out.println(foods.subList(1,3));
        //Random random = new Random();
        //System.out.println(foods.get(random.nextInt(13)).getFoodName());
    }





}
